﻿using System;
using System.Globalization;
using System.Text;
using System.Windows;
using System.Windows.Input;

namespace calendar_generator
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window
	{
		public MainWindow()
		{
			InitializeComponent();

			StringBuilder txt = new StringBuilder();

			/*
			//DateTime date = new DateTime(2013, 2, 27);	// дзя(+)дзъ
			DateTime date = new DateTime(1977, 11, 5);	// бин(+)ин
			txt.Append(date.ToString("yyyy-MM-dd")); txt.Append(Environment.NewLine);
			Binominal bi = new Binominal(date);
			txt.Append(bi); txt.Append(Environment.NewLine);

			TimelineGenerator seasons = new TimelineGenerator(2009);
			foreach (Timeline line in seasons.Seasons)
			{
				txt.Append(line);
				txt.Append(Environment.NewLine);
			}

			seasons = new TimelineGenerator(2010);
			foreach (Timeline line in seasons.Seasons)
			{
				txt.Append(line);
				txt.Append(Environment.NewLine);
			}
			*/

			/*
			// Iterate through the year's days
			int year = 2010;
			DateTime startDate = new DateTime(year, 1, 1);
			DateTime endDate = new DateTime(year, 12, 31);
			for (DateTime date = startDate; date.Date <= endDate.Date; date = date.AddDays(1))
			{
				Binominal bi = new Binominal(date);
				txt.Append(date.ToString("ddd", new CultureInfo("bg-BG")).Substring(0, 2) + " - ");
				txt.Append(date.ToString("yyyy-MM-dd") + " - ");
				txt.Append(bi); txt.Append(Environment.NewLine);
			}
			*/

			// Iterate through the month's days
			/*
			int year = 2010;
			DateTime date;
			for (int i = 0; i < 7; i += 6)
			{
				for (int day = 1; day <= 31; day++)
				{
					txt.Append("\t\t\t\t<tr>" + Environment.NewLine + "\t\t\t\t\t");
					for (int month = 1; month <= 6; month++)
					{
						try { date = new DateTime(year, month + i, day); }
						catch { date = DateTime.MinValue; }
						if (date != DateTime.MinValue)
						{
							if (month == 1)
							{
								txt.Append("<td>");
								txt.Append(date.Day.ToString());
								txt.Append("</td>");
							}

							Binominal bi = new Binominal(date);
							txt.Append(bi.TdTriad);
						}
						else
						{
							//txt.Append("<td colspan=\"3\"></td>");
							txt.Append("<td></td><td></td><td></td>");
						}
					}
					txt.Append(Environment.NewLine + "\t\t\t\t</tr>");
					txt.Append(Environment.NewLine);
				}
				txt.Append(Environment.NewLine);
				txt.Append("<!-- ================================================================ -->");
				txt.Append(Environment.NewLine);
			}
			*/
			// Type: 0 - Annie's way; 1 - Russian notification
			HtmlRowsGenerator hrg = new HtmlRowsGenerator(2015, 0);
			tbFree.Text = hrg.RowHtml;
		}

		private void MainWnd_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
		{
			switch (e.Key)
			{
				case Key.Escape:
					Application.Current.Shutdown();
					break;
				case Key.F1:
					break;
			}

		}
	}
}
